home *** CD-ROM | disk | FTP | other *** search
/ Software USA 4 #8 / Software USA Volume 4.08.iso / pc / children / creation / install / cstation.ms_ / cstation.ms
Text File  |  1997-03-25  |  7KB  |  220 lines

  1. '**************************************************************************
  2. '*                       MSSetup Toolkit Sample 1
  3. '**************************************************************************
  4.  
  5. '$DEFINE DEBUG  ''Define for script development/debugging
  6.  
  7. '$INCLUDE 'setupapi.inc'
  8. '$INCLUDE 'msdetect.inc'
  9.  
  10. ''Dialog ID's
  11. CONST WELCOME       = 100
  12. CONST ASKQUIT       = 200
  13. CONST DESTPATH      = 300
  14. CONST EXITFAILURE   = 400
  15. CONST EXITQUIT      = 600
  16. CONST EXITSUCCESS   = 700
  17. ''CONST OPTIONS       = 800
  18. CONST APPHELP       = 900
  19. CONST BADPATH       = 6400
  20.  
  21. ''Bitmap ID
  22. CONST LOGO = 1
  23.  
  24. GLOBAL DEST$        ''Default destination directory.
  25. GLOBAL OPTCUR$      ''Option selection from option dialog.
  26.  
  27. DECLARE SUB Install
  28. DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  29.  
  30.  
  31. INIT:
  32.     CUIDLL$ = "mscuistf.dll"            ''Custom user interface dll
  33.     HELPPROC$ = "FHelpDlgProc"          ''Help dialog procedure
  34.  
  35.     SetBitmap CUIDLL$, LOGO
  36.     SetTitle "Creation Station Setup"
  37.  
  38.     szInf$ = GetSymbolValue("STF_SRCINFPATH")
  39.     IF szInf$ = "" THEN
  40.         szInf$ = GetSymbolValue("STF_CWDDIR") + "SETUP.INF"
  41.     END IF
  42.     ReadInfFile szInf$
  43.  
  44.     OPTCUR$ = "1"
  45.     DEST$ = "C:\CSTATION"
  46.  
  47. '$IFDEF DEBUG
  48.     i% = SetSizeCheckMode(scmOnIgnore)    '' could use scmOff; def = scmOnFatal
  49.     WinDrive$ = MID$(GetWindowsDir, 1, 1)
  50.     IF IsDriveValid(WinDrive$) = 0 THEN
  51.         i% = DoMsgBox("Windows drive ('"+WinDrive$+"') is not a valid drive.", "DEBUG", MB_TASKMODAL+MB_ICONHAND+MB_OK)
  52.         GOTO QUIT
  53.     END IF
  54. '$ENDIF ''DEBUG
  55.  
  56.  
  57. WELCOME:
  58.     sz$ = UIStartDlg(CUIDLL$, WELCOME, "FInfoDlgProc", APPHELP, HELPPROC$)
  59.     IF sz$ = "CONTINUE" THEN
  60.         UIPop 1
  61.     ELSE
  62.         GOSUB ASKQUIT
  63.         GOTO WELCOME
  64.     END IF
  65.  
  66. GETPATH:
  67.     SetSymbolValue "EditTextIn", DEST$
  68.     SetSymbolValue "EditFocus", "END"
  69. GETPATHL1:
  70.     sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, HELPPROC$)
  71.     DEST$ = GetSymbolValue("EditTextOut")
  72.  
  73.     IF sz$ = "CONTINUE" THEN
  74.         IF IsDirWritable(DEST$) = 0 THEN
  75.             GOSUB BADPATH
  76.             GOTO GETPATHL1
  77.         END IF
  78.         UIPop 1
  79.     ELSEIF sz$ = "REACTIVATE" THEN
  80.         GOTO GETPATHL1
  81.     ELSEIF sz$ = "BACK" THEN
  82.         UIPop 1
  83.         GOTO WELCOME
  84.     ELSE
  85.         GOSUB ASKQUIT
  86.         GOTO GETPATH
  87.     END IF
  88.  
  89.  
  90.     Install
  91.  
  92.  
  93. QUIT:
  94.     ON ERROR GOTO ERRQUIT
  95.  
  96.     IF ERR = 0 THEN
  97.         dlg% = EXITSUCCESS
  98.     ELSEIF ERR = STFQUIT THEN
  99.         dlg% = EXITQUIT
  100.     ELSE
  101.         dlg% = EXITFAILURE
  102.     END IF
  103. QUITL1:
  104.     sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
  105.     IF sz$ = "REACTIVATE" THEN
  106.         GOTO QUITL1
  107.     END IF
  108.     UIPop 1
  109.  
  110.     END
  111.  
  112. ERRQUIT:
  113.     i% = DoMsgBox("Setup sources were corrupted, call 555-1212!", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  114.     END
  115.  
  116.  
  117.  
  118. BADPATH:
  119.     sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
  120.     IF sz$ = "REACTIVATE" THEN
  121.         GOTO BADPATH
  122.     END IF
  123.     UIPop 1
  124.     RETURN
  125.  
  126.  
  127.  
  128. ASKQUIT:
  129.     sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
  130.  
  131.     IF sz$ = "EXIT" THEN
  132.         UIPopAll
  133.         ERROR STFQUIT
  134.     ELSEIF sz$ = "REACTIVATE" THEN
  135.         GOTO ASKQUIT
  136.     ELSE
  137.         UIPop 1
  138.     END IF
  139.     RETURN
  140.  
  141.  
  142.  
  143. '**
  144. '** Purpose:
  145. '**     Builds the copy list and performs all installation operations.
  146. '** Arguments:
  147. '**     none.
  148. '** Returns:
  149. '**     none.
  150. '*************************************************************************
  151. SUB Install STATIC
  152.  
  153.     SrcDir$ = GetSymbolValue("STF_SRCDIR")
  154.     CreateDir DEST$, cmoNone
  155.  
  156.     OpenLogFile MakePath(DEST$, "LOGFILE.OUT"), 0
  157.     WriteToLogFile ""
  158.     WriteToLogFile "  User chose as destination directory: '" + DEST$ + "'"
  159.     WriteToLogFile "  User chose option: '" + OPTCUR$ + "'"
  160.     WriteToLogFile ""
  161.     WriteToLogFile "May have had to create the directory: " + DEST$
  162.     WriteToLogFile ""
  163.  
  164.     CreateDir MakePath (DEST$, "BKSHELF"), cmoNone
  165.     CreateDir MakePath (DEST$, "SAVEFILE"), cmoNone
  166.  
  167.     AddSectionFilesToCopyList "Files", SrcDir$, DEST$
  168.     AddSectionFilesToCopyList "BookShelf", SrcDir$, MakePath (DEST$, "BKSHELF")
  169.     CopyFilesInCopyList
  170.  
  171.     ini$ = MakePath(DEST$, "CLRBOOK.INI")
  172.     CreateIniKeyValue ini$, "Preferences", "Password", "", cmoNone
  173.     CreateIniKeyValue ini$, "Preferences", "BookShelf", "no", cmoNone
  174.     CreateIniKeyValue ini$, "Preferences", "Print", "no", cmoNone
  175.     CreateIniKeyValue ini$, "Preferences", "DisplayPass", "yes", cmoNone
  176.     CreateIniKeyValue ini$, "Preferences", "Cleanup", "no", cmoNone
  177.     CreateIniKeyValue ini$, "Preferences", "Information", "no", cmoNone
  178.     CreateIniKeyValue ini$, "Preferences", "BookPrefs", "no", cmoNone
  179.     CreateIniKeyValue ini$, "Preferences", "ExitApplication", "no", cmoNone
  180.     CreateIniKeyValue ini$, "Preferences", "ToggleMouse", "no", cmoNone
  181.     CreateIniKeyValue ini$, "Preferences", "Goto Bookshelf on Startup", "no", cmoNone
  182.     CreateIniKeyValue ini$, "Preferences", "Turn Sound Off", "no", cmoNone
  183.     CreateIniKeyValue ini$, "Preferences", "Halt application on sytem error", "yes", cmoNone
  184.     
  185.     CreateProgmanGroup "Berkemeyer Concepts", "", cmoNone
  186.     ShowProgmanGroup  "Berkemeyer Concepts", 1, cmoNone
  187.     CreateProgmanItem "Berkemeyer Concepts", "Creation Station", "cstation.exe", MakePath(DEST$, "cstation.exe")+",0,0,0," +DEST$, cmoOverwrite
  188.     CreateProgmanItem "Berkemeyer Concepts", "Creation Station Help", "winhelp.exe "+MakePath(DEST$,"cstation.hlp"), "", cmoOverwrite
  189.     CreateProgmanItem "Berkemeyer Concepts", "Order Information", "notepad.exe "+MakePath(DEST$,"order.txt"), "", cmoOverwrite
  190.     CreateProgmanItem "Berkemeyer Concepts", "Product Information", "notepad.exe "+MakePath(DEST$,"info.txt"), "", cmoOverwrite
  191.  
  192.     CloseLogFile
  193.  
  194. END SUB
  195.  
  196.  
  197.  
  198. '**
  199. '** Purpose:
  200. '**     Appends a file name to the end of a directory path,
  201. '**     inserting a backslash character as needed.
  202. '** Arguments:
  203. '**     szDir$  - full directory path (with optional ending "\")
  204. '**     szFile$ - filename to append to directory
  205. '** Returns:
  206. '**     Resulting fully qualified path name.
  207. '*************************************************************************
  208. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  209.     IF szDir$ = "" THEN
  210.         MakePath = szFile$
  211.     ELSEIF szFile$ = "" THEN
  212.         MakePath = szDir$
  213.     ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  214.         MakePath = szDir$ + szFile$
  215.     ELSE
  216.         MakePath = szDir$ + "\" + szFile$
  217.     END IF
  218. END FUNCTION
  219.  
  220.